# Copyright (c) 2007, Adobe Systems, Incorporated
# All rights reserved.
# 
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
# 
# * Redistributions of source code must retain the above copyright
#   notice, this list of conditions and the following disclaimer.
# 
# * Redistributions in binary form must reproduce the above copyright
#   notice, this list of conditions and the following disclaimer in the
#   documentation and/or other materials provided with the distribution.
# 
# * Neither the name of Adobe Systems, Network Resonance nor the names of its
#   contributors may be used to endorse or promote products derived from
#   this software without specific prior written permission.
# 
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

# ICE_STUN_TEST_ARCHIVE:
#    source files to compile to object and to place in a library archive
#
# ICE_STUN_TEST_ARCHIVE_NAME:
#    the library name to use to archive the object files
#
# ICE_STUN_TEST_ARCHIVE_TYPE:
#    either 'static', 'dynamic', or 'jni' (the default is 'static')
#
# ICE_STUN_TEST_AUTOGENERATED:
#    whether this targets.mk is autogenerated (either 'true' or 'false')
#
# ICE_STUN_TEST_COMPILE:
#    source files to compile to object
#
# ICE_STUN_TEST_COPY:
#    files to copy to the build directory
#
# ICE_STUN_TEST_GLOBAL_CFLAGS:
#    preprocessor and compile-time flags specific to compiling
#    everything
#
# ICE_STUN_TEST_GLOBAL_LDFLAGS:
#    link-time flags specific to linking everything
#
# ICE_STUN_TEST_LINK:
#    source files compile and link
#
# ICE_STUN_TEST_LOCAL_CFLAGS:
#    preprocessor and compile-time flags specific to compiling only
#    the files in this module directory
#
# ICE_STUN_TEST_LOCAL_LDFLAGS:
#    link-time flags specific to linking only the files in
#    this module directory
#
# ICE_STUN_TEST_PREFIX:
#    defines the module name, which also serves as the
#    prefix for all the variable names defined in this file
#
# ICE_STUN_TEST_SUBDIRS:
#    subdirectories containing additional targets.mk files
#
ICE_STUN_TEST_ARCHIVE             = stun_test_util.c udp.c
ICE_STUN_TEST_ARCHIVE_NAME        =
ICE_STUN_TEST_ARCHIVE_TYPE        =
ICE_STUN_TEST_AUTOGENERATED       = true
ICE_STUN_TEST_COMPILE             =
ICE_STUN_TEST_COPY                =
ICE_STUN_TEST_GLOBAL_CFLAGS       =
ICE_STUN_TEST_GLOBAL_LDFLAGS      =
ICE_STUN_TEST_LINK                = client.c dup_addr_test.c \
                                    odd_test_vectors.c remi_vector_test.c \
                                    server.c stun_loopback_test.c \
                                    turn_loopback_test.c turn_test_client.c \
                                    turn_test_server.c
ICE_STUN_TEST_LOCAL_CFLAGS        =
ICE_STUN_TEST_LOCAL_LDFLAGS       =
ICE_STUN_TEST_PREFIX              = ICE_STUN_TEST
ICE_STUN_TEST_SUBDIRS             =



#
#    AUTOMATICALLY-GENERATED SECTION
#



#
#    LOCAL ENVIRONMENT
#
ICE_STUN_TEST_BUILD               = client client.$(OBJSUFFIX) client.d \
                                    dup_addr_test dup_addr_test.$(OBJSUFFIX) \
                                    dup_addr_test.d odd_test_vectors \
                                    odd_test_vectors.$(OBJSUFFIX) \
                                    odd_test_vectors.d remi_vector_test \
                                    remi_vector_test.$(OBJSUFFIX) \
                                    remi_vector_test.d server \
                                    server.$(OBJSUFFIX) server.d \
                                    stun_loopback_test \
                                    stun_loopback_test.$(OBJSUFFIX) \
                                    stun_loopback_test.d \
                                    stun_test_util.$(OBJSUFFIX) \
                                    stun_test_util.d turn_loopback_test \
                                    turn_loopback_test.$(OBJSUFFIX) \
                                    turn_loopback_test.d turn_test_client \
                                    turn_test_client.$(OBJSUFFIX) \
                                    turn_test_client.d turn_test_server \
                                    turn_test_server.$(OBJSUFFIX) \
                                    turn_test_server.d udp.$(OBJSUFFIX) udp.d



#
#    GLOBAL ENVIRONMENT
#
GLOBAL_BUILD                     += $(ICE_STUN_TEST_BUILD)
GLOBAL_CFLAGS                    += $(ICE_STUN_TEST_GLOBAL_CFLAGS) \
                                 -I$(ICE_STUN_TEST_SRCDIR)
GLOBAL_LDFLAGS                   += $(ICE_STUN_TEST_GLOBAL_LDFLAGS)



#
#    GENERIC DEPENDENCIES
#
all:                                $(ICE_STUN_TEST_BUILD)
depend:                             client.d
depend:                             dup_addr_test.d
depend:                             odd_test_vectors.d
depend:                             remi_vector_test.d
depend:                             server.d
depend:                             stun_loopback_test.d
depend:                             stun_test_util.d
depend:                             turn_loopback_test.d
depend:                             turn_test_client.d
depend:                             turn_test_server.d
depend:                             udp.d



#
#    BUILD DEPENDENCIES
#

client.$(OBJSUFFIX): $(ICE_STUN_TEST_SRCDIR)client.c client.d
	$(COMPILE.c) $@ $< $(ICE_STUN_TEST_LOCAL_CFLAGS) $(GLOBAL_CFLAGS)

client.d: $(ICE_STUN_TEST_SRCDIR)client.c
	$(COMPILE.c) $@ $< -MM -MG $(ICE_STUN_TEST_LOCAL_CFLAGS) $(GLOBAL_CFLAGS)

dup_addr_test.$(OBJSUFFIX): $(ICE_STUN_TEST_SRCDIR)dup_addr_test.c dup_addr_test.d
	$(COMPILE.c) $@ $< $(ICE_STUN_TEST_LOCAL_CFLAGS) $(GLOBAL_CFLAGS)

dup_addr_test.d: $(ICE_STUN_TEST_SRCDIR)dup_addr_test.c
	$(COMPILE.c) $@ $< -MM -MG $(ICE_STUN_TEST_LOCAL_CFLAGS) $(GLOBAL_CFLAGS)

odd_test_vectors.$(OBJSUFFIX): $(ICE_STUN_TEST_SRCDIR)odd_test_vectors.c odd_test_vectors.d
	$(COMPILE.c) $@ $< $(ICE_STUN_TEST_LOCAL_CFLAGS) $(GLOBAL_CFLAGS)

odd_test_vectors.d: $(ICE_STUN_TEST_SRCDIR)odd_test_vectors.c
	$(COMPILE.c) $@ $< -MM -MG $(ICE_STUN_TEST_LOCAL_CFLAGS) $(GLOBAL_CFLAGS)

remi_vector_test.$(OBJSUFFIX): $(ICE_STUN_TEST_SRCDIR)remi_vector_test.c remi_vector_test.d
	$(COMPILE.c) $@ $< $(ICE_STUN_TEST_LOCAL_CFLAGS) $(GLOBAL_CFLAGS)

remi_vector_test.d: $(ICE_STUN_TEST_SRCDIR)remi_vector_test.c
	$(COMPILE.c) $@ $< -MM -MG $(ICE_STUN_TEST_LOCAL_CFLAGS) $(GLOBAL_CFLAGS)

server.$(OBJSUFFIX): $(ICE_STUN_TEST_SRCDIR)server.c server.d
	$(COMPILE.c) $@ $< $(ICE_STUN_TEST_LOCAL_CFLAGS) $(GLOBAL_CFLAGS)

server.d: $(ICE_STUN_TEST_SRCDIR)server.c
	$(COMPILE.c) $@ $< -MM -MG $(ICE_STUN_TEST_LOCAL_CFLAGS) $(GLOBAL_CFLAGS)

stun_loopback_test.$(OBJSUFFIX): $(ICE_STUN_TEST_SRCDIR)stun_loopback_test.c stun_loopback_test.d
	$(COMPILE.c) $@ $< $(ICE_STUN_TEST_LOCAL_CFLAGS) $(GLOBAL_CFLAGS)

stun_loopback_test.d: $(ICE_STUN_TEST_SRCDIR)stun_loopback_test.c
	$(COMPILE.c) $@ $< -MM -MG $(ICE_STUN_TEST_LOCAL_CFLAGS) $(GLOBAL_CFLAGS)

stun_test_util.$(OBJSUFFIX): $(ICE_STUN_TEST_SRCDIR)stun_test_util.c stun_test_util.d
	$(COMPILE.c) $@ $< $(ICE_STUN_TEST_LOCAL_CFLAGS) $(GLOBAL_CFLAGS)

stun_test_util.d: $(ICE_STUN_TEST_SRCDIR)stun_test_util.c
	$(COMPILE.c) $@ $< -MM -MG $(ICE_STUN_TEST_LOCAL_CFLAGS) $(GLOBAL_CFLAGS)

turn_loopback_test.$(OBJSUFFIX): $(ICE_STUN_TEST_SRCDIR)turn_loopback_test.c turn_loopback_test.d
	$(COMPILE.c) $@ $< $(ICE_STUN_TEST_LOCAL_CFLAGS) $(GLOBAL_CFLAGS)

turn_loopback_test.d: $(ICE_STUN_TEST_SRCDIR)turn_loopback_test.c
	$(COMPILE.c) $@ $< -MM -MG $(ICE_STUN_TEST_LOCAL_CFLAGS) $(GLOBAL_CFLAGS)

turn_test_client.$(OBJSUFFIX): $(ICE_STUN_TEST_SRCDIR)turn_test_client.c turn_test_client.d
	$(COMPILE.c) $@ $< $(ICE_STUN_TEST_LOCAL_CFLAGS) $(GLOBAL_CFLAGS)

turn_test_client.d: $(ICE_STUN_TEST_SRCDIR)turn_test_client.c
	$(COMPILE.c) $@ $< -MM -MG $(ICE_STUN_TEST_LOCAL_CFLAGS) $(GLOBAL_CFLAGS)

turn_test_server.$(OBJSUFFIX): $(ICE_STUN_TEST_SRCDIR)turn_test_server.c turn_test_server.d
	$(COMPILE.c) $@ $< $(ICE_STUN_TEST_LOCAL_CFLAGS) $(GLOBAL_CFLAGS)

turn_test_server.d: $(ICE_STUN_TEST_SRCDIR)turn_test_server.c
	$(COMPILE.c) $@ $< -MM -MG $(ICE_STUN_TEST_LOCAL_CFLAGS) $(GLOBAL_CFLAGS)

udp.$(OBJSUFFIX): $(ICE_STUN_TEST_SRCDIR)udp.c udp.d
	$(COMPILE.c) $@ $< $(ICE_STUN_TEST_LOCAL_CFLAGS) $(GLOBAL_CFLAGS)

udp.d: $(ICE_STUN_TEST_SRCDIR)udp.c
	$(COMPILE.c) $@ $< -MM -MG $(ICE_STUN_TEST_LOCAL_CFLAGS) $(GLOBAL_CFLAGS)

$(GLOBAL_LIBNAME): stun_test_util.$(OBJSUFFIX)

$(GLOBAL_LIBNAME): udp.$(OBJSUFFIX)

client: client.$(OBJSUFFIX) $(GLOBAL_LIBNAME)
	$(LINK.c) $@ client.$(OBJSUFFIX) $(ICE_STUN_TEST_LOCAL_LDFLAGS) $(GLOBAL_LDFLAGS)

dup_addr_test: dup_addr_test.$(OBJSUFFIX) $(GLOBAL_LIBNAME)
	$(LINK.c) $@ dup_addr_test.$(OBJSUFFIX) $(ICE_STUN_TEST_LOCAL_LDFLAGS) $(GLOBAL_LDFLAGS)

odd_test_vectors: odd_test_vectors.$(OBJSUFFIX) $(GLOBAL_LIBNAME)
	$(LINK.c) $@ odd_test_vectors.$(OBJSUFFIX) $(ICE_STUN_TEST_LOCAL_LDFLAGS) $(GLOBAL_LDFLAGS)

remi_vector_test: remi_vector_test.$(OBJSUFFIX) $(GLOBAL_LIBNAME)
	$(LINK.c) $@ remi_vector_test.$(OBJSUFFIX) $(ICE_STUN_TEST_LOCAL_LDFLAGS) $(GLOBAL_LDFLAGS)

server: server.$(OBJSUFFIX) $(GLOBAL_LIBNAME)
	$(LINK.c) $@ server.$(OBJSUFFIX) $(ICE_STUN_TEST_LOCAL_LDFLAGS) $(GLOBAL_LDFLAGS)

stun_loopback_test: stun_loopback_test.$(OBJSUFFIX) $(GLOBAL_LIBNAME)
	$(LINK.c) $@ stun_loopback_test.$(OBJSUFFIX) $(ICE_STUN_TEST_LOCAL_LDFLAGS) $(GLOBAL_LDFLAGS)

turn_loopback_test: turn_loopback_test.$(OBJSUFFIX) $(GLOBAL_LIBNAME)
	$(LINK.c) $@ turn_loopback_test.$(OBJSUFFIX) $(ICE_STUN_TEST_LOCAL_LDFLAGS) $(GLOBAL_LDFLAGS)

turn_test_client: turn_test_client.$(OBJSUFFIX) $(GLOBAL_LIBNAME)
	$(LINK.c) $@ turn_test_client.$(OBJSUFFIX) $(ICE_STUN_TEST_LOCAL_LDFLAGS) $(GLOBAL_LDFLAGS)

turn_test_server: turn_test_server.$(OBJSUFFIX) $(GLOBAL_LIBNAME)
	$(LINK.c) $@ turn_test_server.$(OBJSUFFIX) $(ICE_STUN_TEST_LOCAL_LDFLAGS) $(GLOBAL_LDFLAGS)
